package com.naiterui.ehp.bp.enums;

/**
 * 是否枚举 全局  1是   0否
 * @author 胡超雄
 * @date 2021/4/2 10:20
 * @desc
 */
public enum YesOrNoEnum {

    YES(1, "是"),
    NO(0, "否"),
    ;
    private Integer code;
    private String name;

    YesOrNoEnum(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    public static YesOrNoEnum getByCode(Integer code) {
        for (YesOrNoEnum tmpEnum : values()) {
            if (tmpEnum.getCode().equals(code)) {
                return tmpEnum;
            }
        }
        return null;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

}
